﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Windows;
using System.Windows.Media;

namespace Writespace.Dialogs
{
    /// <summary>
    /// This idea is from .NET Rocker blog, http://www.thomasclaudiushuber.com/blog/2008/01/10/bind-to-methods-with-objectdataprovider/
    /// Thanks to Thomas Claudius Huber 
    /// </summary>
    public static class ColorHelper
    {
        public static IEnumerable<string> GetColorNames()
        {
            return typeof (Colors).GetProperties(BindingFlags.Public | BindingFlags.Static).Select(p => p.Name);
        }
    }

    public static class AlignmentsHelper
    {
        public static IEnumerable<string> GetAlignments()
        {
            // return new[] {"Left", "Right", "Center"}.ToList();

            return Enum.GetNames(typeof (TextAlignment));
        }
    }
    
    public static class FontHelper
    {
        public static IEnumerable<string> GetFontNames()
        {
            foreach (var fontFamily in Fonts.SystemFontFamilies.OrderBy(f => f.Source))
            {
                yield return fontFamily.Source;

                if (fontFamily.FamilyTypefaces.Any(f => f.Weight == FontWeights.Light))
                    yield return fontFamily.Source + " Light";
            }
        }
    }

    public static class SizeHelper
    {
        public static IEnumerable<int> GetFontSizes()
        {
            for (var i = 6; i <= 64; i = i + 2)
                yield return i;
        }
    }

    public static class MarginHelper
    {
        public static IEnumerable<int> GetMarginSizes()
        {
            for (var i = 0; i <= 200; i = i + 10)
                yield return i;
        }
    }
}
